<div id="street-list">

    <?php $this->addScriptPath('../application/views/scripts/'); ?>
    <?= $this->paginationControl($this->paginator, 'Sliding', 'paginator.phtml') ?>

    <div class="clr"></div>

    <table class="dataActions" width="100%" border="0" cellpadding="0" cellspacing="0" >

        <tr>
            <th>Cabinet</th>
            <th>Switch</th>
            <th>Team members</th>
            <th>Houses</th>
            <th>Progress</th>
            <th>Tomtprojektering</th>
            <th>Anmarkning tomt</th>
            <th>Gravd datum</th>
            <th>Gravd av</th>
            <th>Gravd meter</th>
            <th>Gravd timmar</th>
            <th>Kopplad</th>
            <th>Files</th>            
        </tr>
        <?php foreach ($this->paginator as $item) { 
                $progress = $this->streetDiggingProgress($item['id']);
            ?>
            <script>
                $(function() {
                    $( "#<?php echo $item['id']; ?>" ).progressbar({
                        value: <?php echo intval($progress); ?>
                    });
                });    
            </script>
            <tr>
                <?php
                $teamNames = $this->streetTeamNames($item['id']);
                ?>
                <td><?php echo $item['cabinet_name']; ?></td>
                <td><?php echo $item['name']; ?></td>
                <td><?php echo $teamNames; ?></td>
                <td><a href="<?php echo $this->url(array('controller' => 'myhouses', 'action' => 'index', 'id' => $item['id'])); ?>">Houses</a></td>
                <td><div id="<?php echo $item['id']; ?>"></div></td>
                <td><?php echo $item['tomtprojektering']; ?></td>
                <td><?php echo $item['anmarkning_tomt']; ?></td>
                <td><?php echo $item['gravd_datum']; ?></td>
                <td><?php echo $item['gravd_av']; ?></td>
                <td><?php echo $item['gravd_meter']; ?></td>
                <td><?php echo $item['gravd_timmar']; ?></td>
                <td><?php echo $item['kopplad']; ?></td>
                <td><a href="javascript:void(0)" onclick="addFiles('<?php echo $item['id']; ?>','<?php echo $item['cabinet']; ?>')"> files</a></td>                
            </tr>           
        <?php } ?>


    </table>
</div>
<script>       
    function addFiles(id,cabinet) {
        $("#add-document-form").load("<?= $this->baseURI(); ?>street/mynotification/files/"+id+"/"+cabinet);
        $( "#add-document-form" ).dialog( "open" );
    }
</script>